package com.huhu.SpringDemo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.huhu.SpringBean.Boy;
import com.huhu.SpringDemo.Bean.Gril;

/*
 * @Controller和@RestController的区别
 * @RestController is a stereotype annotation that combines @ResponseBody and @Controller.
 * 
 */

@ComponentScan(basePackages="com.huhu")
@RestController
public class HelloController {
	
    @Value("${str1}")
    private String str1;
    @Value("${str2}")
	private String str2;
    @Value("${content}")
    private String content; 
    
    @Autowired
    private Gril gril;
    
    @Autowired
    private Boy boy;
    //405--错误的请求
	@RequestMapping(value = "/hello",method=RequestMethod.GET)
	public String say() {
		return "huhu";
		//+" "+content+"  "+gril.getName()+" "+boy.getName()
		//return gril.getName()+" "+boy.getName();
	}
}
